home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / novapi.arc / NOVAPI.PAS next >
Pascal/Delphi Source File  |  1988-06-03  |  2KB  |  83 lines

  1. {============================}
  2. { Novell Netware Application }
  3. { Programming Interface Unit }
  4. { Richard Casey              }
  5. { CIS 72247,151              }
  6. {============================}
  7.  
  8. {===========================================================================
  9.  
  10. Types:
  11.          None
  12.  
  13. Procedures:
  14.          None
  15.  
  16. Functions:
  17.  
  18.          NovellLogicalID            Returns logical id (or station number)
  19.          NovellPhysicalID           Returns physical network address
  20.          NovellLogonName            Returns logon name (or ?????)
  21.  
  22. ===========================================================================}
  23.  
  24. unit NovAPI;
  25.  
  26. interface
  27.  
  28. uses dos;
  29.  
  30. function NovellLogicalID : byte;
  31.   inline($B4/$DC/          {MOV AH,DC}
  32.          $CD/$21);         {INT 21}
  33.  
  34. function NovellPhysicalID : word;
  35.   inline($B4/$EE/          {MOV AH,EE}
  36.          $CD/$21);         {INT 21}
  37.  
  38. function NovellLogonName : string;
  39.  
  40. implementation
  41.  
  42. function NovellLogonName : string;
  43.   var
  44.     i             : integer;
  45.     tmp           : string;
  46.     r             : Registers;
  47.     RequestPacket : record
  48.                       PacketLength : word;
  49.                       LogFunction  : byte;
  50.                       Connection   : byte;
  51.                     end;
  52.     ReplyPacket   : record
  53.                       ReturnLength : word;
  54.                       UniqueID     : longint;
  55.                       ReturnType   : word;
  56.                       ObjectName   : array[1..48] of char;
  57.                       LogTime      : array[1..8] of byte;
  58.                     end;
  59.   begin
  60.     RequestPacket.PacketLength:=2;
  61.     RequestPacket.LogFunction:=22;
  62.     RequestPacket.Connection:=NovellLogicalID;
  63.     ReplyPacket.ReturnLength:=64;
  64.     with r do begin
  65.       DS:=seg(RequestPacket);
  66.       SI:=ofs(RequestPacket);
  67.       ES:=seg(ReplyPacket);
  68.       DI:=ofs(ReplyPacket);
  69.       AH:=$E3;
  70.     end;
  71.     MsDOS(r);
  72.     tmp:='?????';
  73.     if r.AL=0 then begin
  74.       i:=1;
  75.       while (ReplyPacket.ObjectName[i]<>#0) and (i<48) do inc(i);
  76.       move(ReplyPacket.ObjectName[1],tmp[1],i);
  77.       tmp[0]:=char(i);
  78.     end;
  79.     NovellLogonName:=tmp;
  80.   end;
  81.  
  82. end.
  83.